// 用户相关类型
export interface User {
  id: number;
  username: string;
  email: string;
  createTime: string;
  roles?: Role[];
}

export interface Role {
  id: number;
  name: string;
  description?: string;
  permissions?: Permission[];
}

export interface Permission {
  id: number;
  code: string;
  description: string;
}

export interface Menu {
  id: number;
  name: string;
  path: string;
  parentId?: number;
  icon?: string;
  sort?: number;
  children?: Menu[];
}

// 支付相关类型
export interface PaymentOrder {
  id: number;
  orderNo: string;
  amount: number;
  status: PaymentStatus;
  paymentMethod: string;
  createTime: string;
  completeTime?: string;
}

export enum PaymentStatus {
  PENDING = 'pending',
  SUCCESS = 'success',
  FAILED = 'failed',
  CANCELLED = 'cancelled',
}

// 报表相关类型
export interface ReportData {
  date: string;
  value: number;
  category?: string;
}

export interface ReportConfig {
  title: string;
  type: 'line' | 'bar' | 'pie';
  dateRange: [string, string];
  metrics: string[];
}

// API响应类型
export interface ApiResponse<T = any> {
  code: number;
  message: string;
  data: T;
  timestamp: number;
}

export interface PaginatedResponse<T> {
  list: T[];
  total: number;
  page: number;
  pageSize: number;
}

// 通用查询参数
export interface QueryParams {
  page?: number;
  pageSize?: number;
  keyword?: string;
  sortBy?: string;
  sortOrder?: 'asc' | 'desc';
}

// 监控数据类型
export interface SystemMetrics {
  cpu: number;
  memory: number;
  disk: number;
  network: {
    in: number;
    out: number;
  };
  timestamp: number;
}

// 脚本管理相关类型
export interface Script {
  id: number;
  name: string;
  description?: string;
  type: 'node' | 'python' | 'bash';
  content: string;
  status: string;
  createdBy?: number;
  updatedBy?: number;
  createdAt: string;
  updatedAt: string;
}

export interface ScriptExecution {
  id: number;
  scriptId: number;
  status: 'running' | 'completed' | 'failed' | 'cancelled';
  output?: string;
  error?: string;
  exitCode?: number;
  startTime: string;
  endTime?: string;
  executedBy?: number;
  createdAt: string;
  script?: Script;
}

export interface CreateScriptRequest {
  name: string;
  description?: string;
  type: 'node' | 'python' | 'bash';
  content: string;
}

export interface UpdateScriptRequest {
  name?: string;
  description?: string;
  type?: 'node' | 'python' | 'bash';
  content?: string;
  status?: string;
}

export interface ExecuteScriptRequest {
  args?: string;
  parameters?: Record<string, string>;
}

export interface ScriptParameter {
  name: string;
  defaultValue: string;
  description?: string;
}